package com.jtjrenren.android.taxi.passenger.core.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.jtjrenren.android.taxi.passenger.R;
import com.jtjrenren.android.taxi.passenger.bean.api.DriverImgs;
import com.jtjrenren.android.taxi.passenger.base.BaseRcyAdapter;
import com.jtjrenren.android.taxi.passenger.utils.InitView;
import com.nostra13.universalimageloader.core.ImageLoader;

/**
 * Created by Administrator on 2016/1/31.
 */
public class DriverImgAdapter extends BaseRcyAdapter<DriverImgs.ResultEntity> {
    public DriverImgAdapter(Context context) {
        super(context);
    }

    @Override
    public RecyclerView.ViewHolder getItemViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_driver_imgs, parent, false);
        return new DriverImgViewHolder(view);
    }

    @Override
    public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) {
        DriverImgs.ResultEntity info = list.get(position);

        DriverImgViewHolder iHolder = (DriverImgViewHolder) holder;
        ImageLoader.getInstance().displayImage(info.getPlink(), iHolder.iv_img, InitView.getDisplayOptions());
    }

    public class DriverImgViewHolder extends RecyclerView.ViewHolder {
        ImageView iv_img;

        public DriverImgViewHolder(View itemView) {
            super(itemView);

            iv_img = (ImageView) itemView.findViewById(R.id.item_driver_imgs_img);
        }
    }
}
